'use strict';


//var backOfficeHost = 'app.66xiaoqu.com';
//var fastDfsHostIp = 'http://t.res.66xiaoqu.com';

angular.module('backofficeApp', ['ngRoute', 'ngResource', "backofficeApp.retailerExchange.controller",
    'backofficeApp.communityRewardRule.controller', 'backofficeApp.communityRewardRule.services',
    'backofficeApp.retailerBalance.controller', 'backofficeApp.retailerBalance.services',
    'backofficeApp.questionManager.controllers', 'backofficeApp.questionManager.services',
    'backofficeApp.shortMessageManager.controllers', 'backofficeApp.shortMessageManager.services',
    'backofficeApp.customerManager.controllers', 'backofficeApp.customerManager.services',
    'backofficeApp.topicManager.controllers', 'backofficeApp.topicManager.services',
    'backofficeApp.login.controllers', 'backofficeApp.frontendUser.controllers',
    'backofficeApp.backendUser.controllers', 'backofficeApp.backendUser.services',
    'backofficeApp.backendServiceUser.controllers', 'backofficeApp.backendServiceUser.services',
    'backofficeApp.backendHome.controllers', 'backofficeApp.voucherManager.controllers',
    'backofficeApp.retailerManager.controllers', 'backofficeApp.retailerCommunity.controllers',
    'backofficeApp.backendConsole.controllers', 'backofficeApp.scoreShopManager.controllers',
    'backofficeApp.mutualAidManager.controllers', 'backofficeApp.promotionCode.controllers',
    'backofficeApp.bannerList.controllers', 'backofficeApp.bannerAdd.controllers',
    'backofficeApp.bannerEdit.controllers', 'backofficeApp.bannerOrder.controllers',
    'backofficeApp.reportManager.controller', 'backofficeApp.replyAtCsService.controllers',
    'backofficeApp.questionAdd.controllers',
    'backofficeApp.appErrorLog.controllers', "backofficeApp.lotteryActivity.controller"]).
    config(['$routeProvider', function ($routeProvider) {

        //default路由
        //$routeProvider.
        //    when('/', {templateUrl: 'partials/login.html', controller: "loginCtrl", requireLogin: false});
        //
        ////HomePage路由
        //$routeProvider.
        //    when('/index', {
        //        templateUrl: 'partials/index.html',
        //        controller: 'backendHomeCtrl'
        //    });
        //
        ////登录路由
        //$routeProvider.
        //    when('/login', {templateUrl: 'partials/login.html', controller: "loginCtrl", requireLogin: false});
        //
        ////后台用户管理
        //$routeProvider.
        //    when('/backendUser', {
        //        templateUrl: 'partials/system/backendUser/backendUser-List.html',
        //        controller: "backendUserCtrl",
        //        requireLogin: true
        //    });
        ////when('/backendUser', checkAuthentication('partials/system/backendUser/backendUser-List.html', 'backendUserCtrl'));
        //
        //$routeProvider.
        //    when('/backendServiceUser', {
        //        templateUrl: 'partials/system/backendUser/backendServiceUser-List.html',
        //        controller: "backendServiceUserCtrl",
        //        requireLogin: true
        //    });
        //
        ////前台用户管理
        //$routeProvider.
        //    when('/frontendUser', {
        //        templateUrl: 'partials/system/frontendUser/frontendUser-List.html',
        //        controller: "frontendUserCtrl",
        //        requireLogin: true
        //    });
        ////when('/frontendUser', checkAuthentication('partials/system/frontendUser/frontendUser-List.html', 'frontendUserCtrl'));
        //
        //$routeProvider.
        //    when('/scoreShop', {
        //        templateUrl: 'partials/operation/scoreShop/scoreShopList.html',
        //        controller: 'scoreShopCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/exchangeRecord', {
        //        templateUrl: 'partials/operation/scoreShop/exchangeRecord.html',
        //        controller: 'exchangeRecordCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/addScore', {
        //        templateUrl: 'partials/operation/scoreShop/addScore.html',
        //        controller: 'addScoreCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/addScoreLogList', {
        //        /*templateUrl: 'partials/system/frontendUser/frontendUser-List.html',*/
        //        templateUrl: 'partials/operation/scoreShop/addScoreLogList.html',
        //        controller: "addScoreLogCtrl",
        //        requireLogin: true
        //    });
        //
        //$routeProvider.
        //    when('/console', {
        //        templateUrl: 'partials/system/console.html',
        //        controller: 'backendConsoleCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/download', {
        //        templateUrl: 'partials/system/download.html',
        //        controller: 'downloadCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/pushRecord', {
        //        templateUrl: 'partials/system/pushRecord.html',
        //        controller: 'pushRecordCtrl'
        //    });
        //
        ////运营管理
        //$routeProvider.
        //    when('/specialNews', {
        //        templateUrl: 'partials/operation/merchant/specialNewsList.html',
        //        controller: 'specialNewsCtrl'
        //    });
        //$routeProvider.
        //    when('/specialNews/add', {
        //        templateUrl: 'partials/operation/merchant/specialNewsAdd.html',
        //        controller: 'specialNewsCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/activity', {
        //        templateUrl: 'partials/operation/merchant/activityList.html',
        //        controller: 'activityCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/push', {
        //        templateUrl: 'partials/operation/merchant/push.html',
        //        controller: 'pushCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/promotionCode', {
        //        templateUrl: 'partials/system/promotionCode.html',
        //        controller: 'promotionCodeCtrl'
        //    });
        ////错误日志
        //$routeProvider.
        //    when('/appErrorLog', {
        //        templateUrl: 'partials/system/appErrorLog.html',
        //        controller: 'appErrorLogCtrl'
        //    });
        //
        ////问答路由
        //$routeProvider.
        //    when('/questionManager', {
        //        templateUrl: 'partials/operation/question/questionList.html',
        //        controller: 'questionListCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/recommendQuestion/:communityId/:category/:tagflg/:replieflg/:nickname/:description/:startDate/:endDate/:level', {
        //        templateUrl: 'partials/operation/question/recommendList.html',
        //        controller: 'recommendCtrl'
        //    });
        //$routeProvider.
        //    when('/questionManager/add', {
        //        templateUrl: 'partials/operation/question/questionAdd.html',
        //        controller: 'questionAddCtrl'
        //    });
        //$routeProvider.
        //    when('/questionManager/edit/:objId/:community/:category/:tagflg/:replieflg/:nickname/:description/:startDate/:endDate/:level', {
        //        templateUrl: 'partials/operation/question/questionEdit.html',
        //        controller: 'questionEditCtrl'
        //    });
        //$routeProvider.
        //    when('/questionManager/reply/:objId/:token', {
        //        templateUrl: 'partials/operation/question/replyList.html',
        //        controller: 'replyListCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/noReplyQuestion', {
        //        templateUrl: 'partials/operation/question/noReplyQuestion.html',
        //        controller: 'noReplyCtrl'
        //    });
        //$routeProvider.
        //    when('/reportQuestion', {
        //        templateUrl: 'partials/operation/question/reportQuestion.html',
        //        controller: 'reportCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/question/add', {
        //        templateUrl: 'partials/operation/question/questionAdd.html',
        //        controller: 'questionAddCtrl'
        //    });
        //
        ////短信路由
        //$routeProvider.
        //    when('/shortMessageManager', {
        //        templateUrl: 'partials/operation/shortMessage/shortMessageList.html',
        //        controller: 'shortMessageListCtrl'
        //    });
        //
        ////环信IM聊天路由
        //$routeProvider.
        //    when('/chatMessageManager', {//TODO:
        //        templateUrl: 'partials/operation/shortMessage/chatMessageList.html',//TODO,页面改回来
        //        controller: 'chatMessageListCtrl'
        //    });
        //
        ///* 个性化推荐效果分析 2015-4-14 */
        //$routeProvider.
        //    when('/interest', {
        //        templateUrl: 'partials/operation/shortMessage/interest.html',//TODO,页面改回来
        //        controller: 'interestCtrl'
        //    });
        //
        ////客服管理
        //$routeProvider.
        //    when('/customerManager', {
        //        templateUrl: 'partials/operation/customer/customerList.html',
        //        controller: 'customerListCtrl'
        //    });
        //$routeProvider.
        //    when('/authentication', {
        //        templateUrl: 'partials/operation/customer/authenticationList.html',
        //        controller: 'customerListCtrl'
        //    });
        //$routeProvider.
        //    when('/feedback', {
        //        templateUrl: 'partials/operation/customer/feedbackList.html',
        //        controller: 'feedbackCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/supplement', {
        //        templateUrl: 'partials/operation/customer/supplementList.html',
        //        controller: 'supplementCtrl'
        //    });
        //$routeProvider.
        //    when('/community', {
        //        templateUrl: 'partials/operation/customer/communityList.html',
        //        controller: 'supplementCtrl'
        //    });
        //$routeProvider.
        //    when('/community/edit/:objId', {
        //        templateUrl: 'partials/operation/customer/communityEdit.html',
        //        controller: 'communityEditCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/community/add', {
        //        templateUrl: 'partials/operation/customer/communityAdd.html',
        //        controller: 'communityAddCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/community/applications', {
        //        templateUrl: 'partials/operation/customer/communityApplications.html',
        //        controller: 'communityApplicationsCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/notice', {
        //        templateUrl: 'partials/operation/customer/noticeList.html',
        //        controller: 'noticeCtrl'
        //    });
        //$routeProvider.
        //    when('/addNotice', {
        //        templateUrl: 'partials/operation/customer/noticeAdd.html',
        //        controller: 'noticeAddCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/notice/:noticeId', {
        //        templateUrl: 'partials/operation/customer/noticeAdd.html',
        //        controller: 'noticeEditCtrl'
        //    });
        //
        ////专题
        //$routeProvider.
        //    when('/topic', {
        //        templateUrl: 'partials/operation/topic/topicList.html',
        //        controller: 'topicListCtrl'
        //    });
        //
        ////专题
        //$routeProvider.
        //    when('/topicAdd', {
        //        templateUrl: 'partials/operation/topic/topicAdd.html',
        //        controller: 'topicListCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/topicEdit/:objId', {
        //        templateUrl: 'partials/operation/topic/topicAdd.html',
        //        controller: 'topicEditCtrl'
        //    });
        //
        ////互助
        //$routeProvider.
        //    when('/mutualAid', {
        //        templateUrl: 'partials/operation/mutualAid/aidList.html',
        //        controller: 'mutualAidCtrl'
        //    });
        //
        ////代价券
        //$routeProvider.
        //    when('/voucherType', {
        //        templateUrl: 'partials/voucher/voucherType.html',
        //        controller: 'voucherTypeCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/voucher', {
        //        templateUrl: 'partials/voucher/voucherList.html',
        //        controller: 'voucherListCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/retailer', {
        //        templateUrl: 'partials/voucher/retailer.html',
        //        controller: 'retailerCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/retailer/:id', {
        //        templateUrl: 'partials/voucher/retailer_branch.html',
        //        controller: 'branchRetailerCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/agreement/:id', {
        //        templateUrl: 'partials/voucher/retailer_agreement.html',
        //        controller: 'agreementCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/retailerCommunity', {
        //        templateUrl: 'partials/voucher/retailer_community.html',
        //        controller: 'retailerCommunityCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/retailerCommunity/:communityId', {
        //        templateUrl: 'partials/voucher/cooperation.html',
        //        controller: 'cooperationCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/retailerExchange', {
        //        templateUrl: 'partials/voucher/retailer_exchange_list.html',
        //        controller: 'retailerExchangeCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/communityRewardRule', {
        //        templateUrl: 'partials/voucher/communityRewardRule_list.html',
        //        controller: 'communityRewardRuleCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/retailerBalance', {
        //        templateUrl: 'partials/voucher/retailer_balance_list.html',
        //        controller: 'retailerBalanceCtrl'
        //    });
        //$routeProvider.
        //    when('/lotteryList', {
        //        templateUrl: 'partials/lottery/lottery_list.html',
        //        controller: 'lotteryActivityCtrl'
        //    });
        //
        ////banner管理
        //$routeProvider.
        //    when('/bannerList/:type', {
        //        templateUrl: 'partials/banner/banner_list.html',
        //        controller: 'bannerListCtrl'
        //    });
        //$routeProvider.
        //    when('/bannerAdd/:type', {
        //        templateUrl: 'partials/banner/banner_add.html',
        //        controller: 'bannerAddCtrl'
        //    });
        //$routeProvider.
        //    when('/bannerEdit/:bannerId', {
        //        templateUrl: 'partials/banner/banner_edit.html',
        //        controller: 'bannerEditCtrl'
        //    });
        //$routeProvider.
        //    when('/bannerOrder/:type/:communityId', {
        //        templateUrl: 'partials/banner/banner_order.html',
        //        controller: 'bannerOrderCtrl'
        //    });
        //$routeProvider.
        //    when('/report', {
        //        templateUrl: 'partials/reports/report.html',
        //        controller: 'reportListCtrl'
        //    });
        //
        //$routeProvider.
        //    when('/lotteryList', {
        //        templateUrl: 'partials/lottery/lottery_list.html',
        //        controller: 'lotteryActivityCtrl'
        //    });
        //$routeProvider.
        //    when('/productList', {
        //        templateUrl: 'partials/lottery/product_list.html',
        //        controller: 'productCtrl'
        //    });
        //$routeProvider.
        //    when('/addProduct', {
        //        templateUrl: 'partials/lottery/add_product.html',
        //        controller: 'addProductCtrl'
        //    });
        //$routeProvider.
        //    when('/updateProduct/:id', {
        //        templateUrl: 'partials/lottery/update_product.html',
        //        controller: 'updateProductCtrl'
        //    });
        //$routeProvider.
        //    when('/getCommunitysByLotteryId/:lotteryId', {
        //        templateUrl: 'partials/lottery/community_list.html',
        //        controller: 'getCommunitysCtrl'
        //    });
        //$routeProvider.
        //    when('/getPrizeByLotteryId/:lotteryId', {
        //        templateUrl: 'partials/lottery/prize_list.html',
        //        controller: 'prizeListCtrl'
        //    });
        //$routeProvider.
        //    when('/addPrize/:lotteryId', {
        //        templateUrl: 'partials/lottery/add_prize.html',
        //        controller: 'addPrizeCtrl'
        //    });
        //$routeProvider.
        //    when('/updatePrize/:prizeId/:lotteryId', {
        //        templateUrl: 'partials/lottery/update_prize.html',
        //        controller: 'updatePrizeCtrl'
        //    });
        //$routeProvider.
        //    when('/awardList/:lotteryId', {
        //        templateUrl: 'partials/lottery/award_list.html',
        //        controller: 'awardListCtrl'
        //    });
        //$routeProvider.
        //    when('/addLottery', {
        //        templateUrl: 'partials/lottery/add_lottery.html',
        //        controller: 'addLotteryCtrl'
        //    });
        //$routeProvider.
        //    when('/updateLottery/:lotteryId', {
        //        templateUrl: 'partials/lottery/update_lottery.html',
        //        controller: 'updateLotteryCtrl'
        //    });
        //$routeProvider.
        //    when('/voucherStatistics', {
        //        templateUrl: 'partials/voucher/voucher_statistics.html',
        //        controller: 'voucherStatisticsCtrl'
        //    });
        //$routeProvider.
        //    when('/voucherConsumeStatistics', {
        //        templateUrl: 'partials/voucher/voucher_consume.html',
        //        controller: 'voucherConsumeCtrl'
        //    });
        //$routeProvider.
        //    when('/voucherIsSettlement', {
        //        templateUrl: 'partials/voucher/voucher_is_settlement.html',
        //        controller: 'voucherIsSettlementCtrl'
        //    });
        //$routeProvider.
        //    when('/replyAtCsList', {
        //        templateUrl: 'partials/cs/reply_atcs_list.html',
        //        controller: 'replyAtCsCtrl'
        //    });
        //$routeProvider.
        //    when('/searchValue', {
        //        templateUrl: 'partials/operation/scoreShop/scoreShopSearchValue.html',
        //        controller: 'scoreShopSearchValueCtrl'
        //    });
    }]
).run(function ($rootScope, $location) {
        $rootScope.$on("$routeChangeStart", function (event, next, current) {
            if (sessionStorage.getItem("isAuthenticated") != "true") {
                $location.path("/login");
            }
        });
    });
;